<?

/**
 * View class
 *
 * @author
 * @version 1.0
*/
class View extends Core {

	function __construct () {
		parent::__construct();
	}

	public function render ($action, $data, $object = null, $wrap = true) {
	
		// Set basic path
		$path = 'themes/' . CONFIG_THEME . '/';
		
		// If a custom template is defined, use it
		if ($object && (file_exists($path . $object . "_" . $action))) {
			$template = $path . $object . "_" . $action . ".tpl";
		} else {
			$template = $path . "default_" . $action . ".tpl";
		}
		
		// Header
		if ($wrap)
			include('themes/' . CONFIG_THEME . '/default_header.tpl');
		
		// Render
		include($template);
		
		// Footer
		if ($wrap)
			include('themes/' . CONFIG_THEME . '/default_footer.tpl');
		
	}

}

?>